using AdmissionQA.Application.Common;
using AdmissionQA.Application.Dtos.QAHistory;
using AdmissionQA.Domain.Entities;

namespace AdmissionQA.Application.ServiceInterfaces;

/// <summary>
/// 问答历史记录服务接口
/// </summary>
public interface IQAHistoryServices
{
    /// <summary>
    /// 创建问答历史记录
    /// </summary>
    /// <param name="qaHistory">问答历史记录</param>
    /// <returns>创建结果</returns>
    Task<Result<string>> CreateQAHistoryAsync(QAHistoryDto qaHistory);

    /// <summary>
    /// 批量创建问答历史记录
    /// </summary>
    /// <param name="qaHistories">问答历史记录列表</param>
    /// <returns>创建结果</returns>
    Task<Result<string>> CreateQAHistoriesAsync(QAHistoriesDto qaHistories);

    /// <summary>
    /// 获取所有问答历史记录
    /// </summary>
    /// <returns>问答历史记录列表</returns>
    Task<Result<IEnumerable<QAHistory>>> GetAllQAHistoriesAsync();

    /// <summary>
    /// 分页获取问答历史记录
    /// </summary>
    /// <param name="pageIndex">页码</param>
    /// <param name="pageSize">页大小</param>
    /// <returns>分页结果</returns>
    Task<Result<IEnumerable<QAHistory>>> GetPagedQAHistoriesAsync(int pageIndex = 0, int pageSize = 10);

    /// <summary>
    /// 根据查询类型获取问答历史记录
    /// </summary>
    /// <param name="queryType">查询类型</param>
    /// <returns>问答历史记录列表</returns>
    Task<Result<IEnumerable<QAHistory>>> GetQAHistoriesByTypeAsync(string queryType);

    /// <summary>
    /// 根据置信度获取问答历史记录
    /// </summary>
    /// <param name="confidence">置信度</param>
    /// <returns>问答历史记录列表</returns>
    Task<Result<IEnumerable<QAHistory>>> GetQAHistoriesByConfidenceAsync(string confidence);

    /// <summary>
    /// 获取问答历史记录数量
    /// </summary>
    /// <returns>数量</returns>
    Task<int> GetQAHistoryCountAsync();

    /// <summary>
    /// 删除问答历史记录
    /// </summary>
    /// <param name="id">记录ID</param>
    /// <returns>删除结果</returns>
    Task<Result<string>> DeleteQAHistoryAsync(Guid id);

    /// <summary>
    /// 批量删除问答历史记录
    /// </summary>
    /// <param name="ids">记录ID列表</param>
    /// <returns>删除结果</returns>
    Task<Result<string>> DeleteQAHistoriesAsync(IEnumerable<Guid> ids);

    /// <summary>
    /// 获取热门查询（按查询次数排序）
    /// </summary>
    /// <param name="topK">返回前K个</param>
    /// <returns>热门查询列表</returns>
    Task<Result<IEnumerable<object>>> GetPopularQueriesAsync(int topK = 10);

    /// <summary>
    /// 获取查询统计信息
    /// </summary>
    /// <returns>统计信息</returns>
    Task<Result<object>> GetQueryStatisticsAsync();
} 